home *** CD-ROM | disk | FTP | other *** search
- /*
- **
- ** $VER: image.c 0.5 (05.11.02)
- ** Description
- **
- ** (C) Copyright 1999 Paul Hill
- ** (C) Copyright 2002 Alexandre Balaban
- **
- ** $HISTORY :
- ** - 0.5, 05.11.02 : Added pack pragma directives for PPC compilation
- ** - 0.4, 04.11.02 : Corrected PPC includes
- ** - 0.3, 03.10.02 : Corrected PPC compilation
- ** - 0.2, 27.07.02 : Cleanup
- ** - 0.1, 27.02.99 : Original version by Paul Hill
- **
- */
-
- #pragma pack(2)
-
- #ifdef __PPC__
- #include </ADE/os-includeppc/proto/graphics.h>
- #include </ADE/os-includeppc/proto/intuition.h>
- #include </ADE/os-includeppc/proto/cybergraphics.h>
- #else
- #include <proto/graphics.h>
- #include <proto/intuition.h>
- #include <clib/cybergraphics_protos.h>
- #endif // __PPC__
-
- #include <cybergraphx/cybergraphics.h>
-
- #pragma pack()
-
- #include <stdio.h>
- #include "swfplayer.h"
-
- extern struct Library *CyberGfxBase;
- #ifdef DITHER_CODE
- char *dith_dither(int w, int h, long *t, unsigned long *i);
- void dith_setup(int dim, int nr, int ng, int nb, unsigned long *ptab,int w,int h);
-
- static int do_dither=0;
- static int dit=0;
- unsigned long ptab[256];
- #endif
-
- void drawchunkypixels(UBYTE *canvasBuffer,LONG bpp,LONG bpl)
- {
- #ifdef FULLSCREEN_CODE
- if (swfinfo.fullscreen)
- {
- // TODO: fullscreen drawing
- }
- else
- #endif
- {
-
- #ifdef DITHER_CODE
- if (do_dither)
- {
- if (!dit)
- {
- dith_setup(2,4,4,4, ptab,swfinfo.width,swfinfo.height);
- dit = 1;
- }
- bpp=1;
- }
- #endif
-
- switch (bpp)
- {
- case 1: // 8bits per pixel
- if (CyberGfxBase)
- {
- WritePixelArray( (APTR) canvasBuffer, // OK!
- 0,
- 0,
- swfinfo.width,
- swfinfo.rport,
- swfinfo.winborderleft,
- swfinfo.winbordertop,
- swfinfo.width,
- swfinfo.height,
- RECTFMT_LUT8);
- } else
- {
- if (swfinfo.kick31)
- {
- WriteChunkyPixels(swfinfo.rport, // OK!
- swfinfo.winborderleft,
- swfinfo.winbordertop,
- swfinfo.width + swfinfo.winborderleft - 1,
- swfinfo.height + swfinfo.winbordertop - 1,
- (UBYTE *) canvasBuffer,
- swfinfo.width);
- }
- else
- {
- /* THIS IS WRONG!!!!! */
- WritePixelArray8( swfinfo.rport,
- swfinfo.winborderleft,
- swfinfo.winbordertop,
- swfinfo.width + swfinfo.winborderleft - 1,
- swfinfo.height + swfinfo.winbordertop - 1,
- (UBYTE *) canvasBuffer,
- swfinfo.tmprport);
- }
- }
- break;
-
- case 2: // 15 / 16bit
- /* CyberGraphic's WritePixelArray()
- doesn't support 15/16bit */
- break;
-
- case 3: // 24 bit RGB format
- /* Flash doesn't support 3bytes/pixel yet.
- I'll probably add it myself later. */
- #ifdef NOT_YET
- WritePixelArray( (APTR) canvasBuffer,
- 0,
- 0,
- bpl,
- swfinfo.rport,
- swfinfo.winborderleft,
- swfinfo.winbordertop,
- swfinfo.width,
- swfinfo.height,
- RECTFMT_RGB);
- #endif
- break;
-
- case 4: // 32 bit ARGB format
- if (CyberGfxBase)
- {
- WritePixelArray( (APTR) canvasBuffer,
- 0,
- 0,
- bpl,
- swfinfo.rport,
- swfinfo.winborderleft,
- swfinfo.winbordertop,
- swfinfo.width,
- swfinfo.height,
- RECTFMT_ARGB);
- }
- break;
- }
- }
- }
-